﻿namespace Acoris.Note.ViewModels
{
    using System;

    using Acoris.Commons;
    using Acoris.ViewModels;


    using Windows.UI.Xaml;
    using Windows.UI.Xaml.Media.Imaging;

    public sealed class MainPageViewModel : ViewModelBase
    {

        public MainPageViewModel()
        {
            _NavigationViewPanelControlCommand = DelegateCommand.CreateCommand(NavigationViewPanelControl);
            _FunctionPanelControlCommand = DelegateCommand.CreateCommand(FunctionPanelControl);
        }

        #region NavigationViewPanelOpenState


        private bool _NavigationViewPanelOpenState;
        /// <summary>
        /// 获取或设置一个值，该值指示导航视图栏是否开启
        /// </summary>
        public bool NavigationViewPanelOpenState {
            get {
                return _NavigationViewPanelOpenState;
            }
            set {
                Set(ref _NavigationViewPanelOpenState, value);
            }
        }


        private DelegateCommand _NavigationViewPanelControlCommand;

        /// <summary>
        /// 获取导航视图栏控制命令
        /// </summary>
        public DelegateCommand NavigationViewPanelControlCommand {
            get {
                return _NavigationViewPanelControlCommand;
            }
        }

        void NavigationViewPanelControl(object param)
        {
            if (_NavigationViewPanelOpenState) {
                NavigationViewPanelOpenState = false;
            }
            else {
                NavigationViewPanelOpenState = true;
            }

            // 互斥
            FunctionPanelOpenState = false;
        }


        #endregion

        #region FunctionPanelOpenState


        private bool _FunctionPanelOpenState;

        /// <summary>
        /// 获取或设置一个值，该值指示功能栏的打开状态
        /// </summary>
        public bool FunctionPanelOpenState {
            get {
                return _FunctionPanelOpenState;
            }
            set {
                Set(ref _FunctionPanelOpenState, value);
            }
        }


        private DelegateCommand _FunctionPanelControlCommand;

        /// <summary>
        /// 获取功能栏的开启状态控制命令
        /// </summary>
        public DelegateCommand FunctionPanelControlCommand {
            get {
                return _FunctionPanelControlCommand;
            }
        }

        void FunctionPanelControl(object param)
        {
            if (_FunctionPanelOpenState) {
                FunctionPanelOpenState = false;
            }
            else {
                FunctionPanelOpenState = true;
            }
            NavigationViewPanelOpenState = false;
        }

        #endregion

        #region UserPanel


        private string _UserName;
        /// <summary>
        /// 获取或设置当前应用的用户名
        /// </summary>
        public string UserName {
            get {
                return _UserName;
            }
            set {
                Set(ref _UserName, value);
            }
        }


        private DelegateCommand _UserPanelCommand;
        /// <summary>
        /// 获取或设置用户栏命令
        /// </summary>
        public DelegateCommand UserPanelCommand {
            get {
                return _UserPanelCommand;
            }
            set {
                Set(ref _UserPanelCommand, value);
            }
        }


        private BitmapImage _UserIcon;
        /// <summary>
        /// 获取或设置用户图标
        /// </summary>
        public BitmapImage UserIcon {
            get {
                return _UserIcon;
            }
            set {
                Set(ref _UserIcon, value);
            }
        }

        #endregion
    }
}
